const { DataTypes } = require("sequelize");
const db = require("../../../database");

const article = db.define('articles', {
    id: {
        type: DataTypes.INTEGER,
        primaryKey: true,
        autoIncrement: true,
        allowNull: false,
        field: "id",
    },
    title: {
        type: DataTypes.STRING,
        allowNull: false,
        field: "title"
    },
    context: {
        type: DataTypes.STRING,
        allowNull: false,
        field: "context"
    },
    type: {
        type: DataTypes.JSON,
        allowNull: false,
        defaultValue: {},
    },
    typeId: {
        type: DataTypes.STRING,
        allowNull: false,
        field: "typeId"
    },
    isdeleted: {
        type: DataTypes.BOOLEAN,
        allowNull: false,
        defaultValue: false,
        field: "isdeleted"
    }
});

(async () => {
    await db.sync({ alert: true })
})()
module.exports = article;
